<?php


namespace support\middleware;


use Webman\MiddlewareInterface;
use Webman\Http\Response;
use Webman\Http\Request;
use Workerman\Worker;

class RequestInfo implements MiddlewareInterface
{
    public function process(Request $request, callable $next): Response
    {
        $response = $next($request);
        Worker::log(Date('Y-m-d H:i:s') . ' ' . $request->method() . $request->uri());
//        echo "参数：".$request->rawHead()."\n";
        Worker::log($request->rawBody());
//        print_r($request->rawHead()."\n"); // header信息
//        print_r(Common::Obj2Array($response)['_body']);
        return $response;
    }

}